<template>
    <div>
        <Modal v-model="data.isShow" :mask-closable="false">
            <p slot="header">
                <span>密码重置</span>
            </p>
            <div style="margin-top: 10px; padding-right: 20px;" >
                <Form ref="form" :model="data.data" :label-width="100" :rules="ruleValidate">
                    <FormItem label="密码重置" prop="pwd">
                        <Input v-model="data.data.pwd"  placeholder="请输入新的密码"></Input>						
					</FormItem>					
                </Form>
            </div>
            <div slot="footer">
				<Button 
					type="primary" 
					@click="handleSubmit">
					确认
				</Button>
			</div>
        </Modal> 
    </div>
</template>

<script>
export default {
    props: ['data'],
    data () {
        return {
            ruleValidate: {
                pwd: [
                    { required: true, message: '请输入新的密码!', trigger: 'blur' },                    
                ]
            }
        };
    },
    methods: {
        handleSubmit(){
            this.$refs['form'].validate((valid) => {
                if (valid) {
                    this.$emit('on-reset', this.data);
                } else {
                    this.$Message.error('表单验证失败!');
                }
            })
        }
    },
};
</script>

<style lang="less" scoped>

</style>
